package com.ysg.http.data;

import com.ysg.base.BaseModel;
import com.ysg.http.BaseListResponse;
import com.ysg.http.BaseResponse;
import com.ysg.http.data.entity.dynamic.CommentEntity;
import com.ysg.http.data.entity.dynamic.DynamicResult;
import com.ysg.http.data.entity.dynamic.ReplyResult;
import com.ysg.http.data.entity.exchange.ExchangeEntity;
import com.ysg.http.data.entity.exchange.ExchangeResult;
import com.ysg.http.data.entity.expression.ExpressionEntity;
import com.ysg.http.data.entity.game.GameCommentEntity;
import com.ysg.http.data.entity.game.GameEntity;
import com.ysg.http.data.entity.gift.GiftResult;
import com.ysg.http.data.entity.home.HomeRankEntity;
import com.ysg.http.data.entity.home.HomeResult;
import com.ysg.http.data.entity.home.HomeSearchEntity;
import com.ysg.http.data.entity.im.ChatBlackEntity;
import com.ysg.http.data.entity.im.ChatDiamondEnoughEntity;
import com.ysg.http.data.entity.im.ChatVideoMatchEntity;
import com.ysg.http.data.entity.im.ImSignEntity;
import com.ysg.http.data.entity.login.LoginResult;
import com.ysg.http.data.entity.mine.CharmEntity;
import com.ysg.http.data.entity.mine.FollowEntity;
import com.ysg.http.data.entity.mine.IntimacyEntity;
import com.ysg.http.data.entity.mine.InviteEntity;
import com.ysg.http.data.entity.mine.InviteIncomeEntity;
import com.ysg.http.data.entity.mine.InviteRankEntity;
import com.ysg.http.data.entity.mine.MineDiamondResult;
import com.ysg.http.data.entity.mine.MineLookResult;
import com.ysg.http.data.entity.mine.MineWalletEntity;
import com.ysg.http.data.entity.mine.PayEntity;
import com.ysg.http.data.entity.mine.PriceResult;
import com.ysg.http.data.entity.mine.ShopEntity;
import com.ysg.http.data.entity.mine.ShopMyResult;
import com.ysg.http.data.entity.mine.SignAddResult;
import com.ysg.http.data.entity.mine.SignResult;
import com.ysg.http.data.entity.mine.TaskEntity;
import com.ysg.http.data.entity.mine.UserConfigEntity;
import com.ysg.http.data.entity.mine.VersionEntity;
import com.ysg.http.data.entity.mine.VipResult;
import com.ysg.http.data.entity.notice.NoticeEntity;
import com.ysg.http.data.entity.notice.NoticeLastResult;
import com.ysg.http.data.entity.notice.NoticeResult;
import com.ysg.http.data.entity.oos.OosTokenBean;
import com.ysg.http.data.entity.tea.TeaEntity;
import com.ysg.http.data.entity.ticket.TicketEntity;
import com.ysg.http.data.entity.ticket.TicketPriceEntity;
import com.ysg.http.data.entity.trip.TripEntity;
import com.ysg.http.data.entity.user.GuardEntity;
import com.ysg.http.data.entity.user.GuardResult;
import com.ysg.http.data.entity.user.UserAddressResult;
import com.ysg.http.data.entity.user.UserAppEntity;
import com.ysg.http.data.entity.user.UserGiftResult;
import com.ysg.http.data.entity.user.UserGuardEntity;
import com.ysg.http.data.entity.user.UserHeightEntity;
import com.ysg.http.data.entity.user.UserLabelResult;
import com.ysg.http.data.entity.user.UserResult;
import com.ysg.http.data.entity.user.UserVoiceResult;
import com.ysg.http.data.entity.user.UserWorkEntity;
import com.ysg.http.data.entity.user.VoiceRandomSignEntity;
import com.ysg.widget.dialog.entity.GiftListResult;
import com.ysg.widget.dialog.entity.GiftNumResult;

import java.io.File;
import java.util.Map;

import io.reactivex.Observable;
import okhttp3.MediaType;
import okhttp3.MultipartBody;
import okhttp3.RequestBody;

/**
 * MVVM的Model层，统一模块的数据仓库，包含网络数据和本地数据（一个应用可以有多个Repository）
 */
public class CommonRepository extends BaseModel {
    private volatile static CommonRepository INSTANCE = null;

    private ApiService apiService;

    private CommonRepository(ApiService apiService) {
        this.apiService = apiService;
    }

    public static CommonRepository getInstance(ApiService apiService) {
        if (INSTANCE == null) {
            synchronized (CommonRepository.class) {
                if (INSTANCE == null) {
                    INSTANCE = new CommonRepository(apiService);
                }
            }
        }
        return INSTANCE;
    }

    //---------------------------------------------------------------------------------------------
    //---------------------------------------------------------------------------------------------
    //---------------------------------------------------------------------------------------------
    public Observable<BaseResponse> sendCode(Map<String, String> map) {
        return apiService.sendCode(map);
    }

    public Observable<BaseResponse> register(Map<String, String> map) {
        return apiService.register(map);
    }

    public Observable<BaseResponse<LoginResult>> login(Map<String, String> map) {
        return apiService.login(map);
    }
    public Observable<BaseResponse<LoginResult>> thirdLogin(Map<String, String> map) {
        return apiService.thirdLogin(map);
    }
    public Observable<BaseResponse<LoginResult>> onKeyLogin(Map<String, String> map) {
        return apiService.onKeyLogin(map);
    }
    public Observable<BaseResponse<ImSignEntity>> imSign(Map<String, String> map) {
        return apiService.imSign(map);
    }
    public Observable<BaseResponse<LoginResult>> loginBind(Map<String, String> map) {
        return apiService.loginBind(map);
    }
    public Observable<BaseResponse> passwordForget(Map<String, String> map) {
        return apiService.passwordForget(map);
    }
    public Observable<BaseResponse> passwordUpdate(Map<String, String> map) {
        return apiService.passwordUpdate(map);
    }
    public Observable<BaseResponse> userInfoImprove(Map<String, String> map) {
        return apiService.userInfoImprove(map);
    }
    public Observable<BaseListResponse<HomeResult>> pageSquare(Map<String, String> map) {
        return apiService.pageSquare(map);
    }

    public Observable<BaseListResponse<HomeResult>> homeCityPage(Map<String, String> map) {
        return apiService.homeCityPage(map);
    }
    public Observable<BaseListResponse<HomeResult>> homeNearPage(Map<String, String> map) {
        return apiService.homeNearPage(map);
    }
    public Observable<BaseListResponse<HomeResult>> homeOnlineList(Map<String, String> map) {
        return apiService.homeOnlineList(map);
    }
    public Observable<BaseListResponse<HomeResult>> homeAccount(Map<String, String> map) {
        return apiService.homeAccount(map);
    }

    public Observable<BaseResponse<OosTokenBean>> oosToken(Map<String, String> map) {
        return apiService.oosToken(map);
    }

    public Observable<BaseResponse<NoticeResult>> noticeList(Map<String, String> map) {
        return apiService.noticeList(map);
    }

    public Observable<BaseResponse<GiftResult>> heart(Map<String, String> map) {
        return apiService.heartGift(map);
    }

    public Observable<BaseResponse<UserResult>> userInfo(Map<String, String> map) {
        return apiService.userInfo(map);
    }
    public Observable<BaseResponse<UserAppEntity>> userInfoApp(Map<String, String> map) {
        return apiService.userInfoApp(map);
    }

    public Observable<BaseResponse> follow(Map<String, String> map) {
        return apiService.follow(map);
    }

    public Observable<BaseListResponse<DynamicResult>> userDynamicPage(Map<String, String> map) {
        return apiService.userDynamicPage(map);
    }

    public Observable<BaseResponse<UserGiftResult>> userGift(Map<String, String> map) {
        return apiService.userGift(map);
    }

    public Observable<BaseResponse<UserGuardEntity>> userGuard(Map<String, String> map) {
        return apiService.userGuard(map);
    }
    public Observable<BaseResponse> noLookDynamic(Map<String, String> map) {
        return apiService.noLookDynamic(map);
    }
    public Observable<BaseResponse> cancelNoLookDynamic(Map<String, String> map) {
        return apiService.cancelNoLookDynamic(map);
    }
    public Observable<BaseResponse> blackUser(Map<String, String> map) {
        return apiService.blackUser(map);
    }
    public Observable<BaseResponse<GiftListResult>> giftList(Map<String, String> map) {
        return apiService.giftList(map);
    }
    public Observable<BaseResponse<GiftNumResult>> giftNum(Map<String, String> map) {
        return apiService.giftNum(map);
    }
    public Observable<BaseResponse> sendGift(Map<String, String> map) {
        return apiService.sendGift(map);
    }
    public Observable<BaseListResponse<DynamicResult>> dynamicPage(Map<String, String> map) {
        return apiService.dynamicPage(map);
    }
    public Observable<BaseListResponse<DynamicResult>> dynamicFollowPage(Map<String, String> map) {
        return apiService.dynamicFollowPage(map);
    }
    public Observable<BaseResponse> dynamicLike(Map<String, String> map) {
        return apiService.dynamicLike(map);
    }
    public Observable<BaseResponse> dynamicRelease(Map<String, String> map) {
        return apiService.dynamicRelease(map);
    }
    public Observable<BaseResponse<DynamicResult>> dynamicDetail(Map<String, String> map) {
        return apiService.dynamicDetail(map);
    }
    public Observable<BaseListResponse<CommentEntity>> dynamicCommentPage(Map<String, String> map) {
        return apiService.dynamicCommentPage(map);
    }
    public Observable<BaseResponse<ReplyResult>> dynamicReplyPage(Map<String, String> map) {
        return apiService.dynamicReplyPage(map);
    }
    public Observable<BaseResponse> dynamicCommentLike(Map<String, String> map) {
        return apiService.dynamicCommentLike(map);
    }
    public Observable<BaseResponse> dynamicCommentReply(Map<String, String> map) {
        return apiService.dynamicCommentReply(map);
    }
    public Observable<BaseResponse> dynamicComment(Map<String, String> map) {
        return apiService.dynamicComment(map);
    }
    public Observable<BaseResponse> dynamicDelete(Map<String, String> map) {
        return apiService.dynamicDelete(map);
    }
    public Observable<BaseResponse<MineWalletEntity>> wallet(Map<String, String> map) {
        return apiService.wallet(map);
    }
    public Observable<BaseResponse<MineDiamondResult>> diamond(Map<String, String> map) {
        return apiService.diamond(map);
    }
    public Observable<BaseResponse<PayEntity>> payWechat(Map<String, String> map) {
        return apiService.payWechat(map);
    }
    public Observable<BaseResponse<PayEntity>> payAlipay(Map<String, String> map) {
        return apiService.payAlipay(map);
    }
    public Observable<BaseResponse<String>> payAlipayApp(Map<String, String> map) {
        return apiService.payAlipayApp(map);
    }
    public Observable<BaseResponse<VipResult>> vip(Map<String, String> map) {
        return apiService.vip(map);
    }
    public Observable<BaseResponse<UserResult>> user(Map<String, String> map) {
        return apiService.user(map);
    }
    public Observable<BaseResponse<ChatBlackEntity>> isBlack(Map<String, String> map) {
        return apiService.isBlack(map);
    }
    public Observable<BaseResponse> videoAudioFee(Map<String, String> map) {
        return apiService.videoAudioFee(map);
    }
    public Observable<BaseResponse> textFee(Map<String, String> map) {
        return apiService.textFee(map);
    }
    public Observable<BaseResponse> videoAudioStatus(Map<String, String> map) {
        return apiService.videoAudioStatus(map);
    }
    public Observable<BaseResponse<ChatDiamondEnoughEntity>> videoAudioIsEnough(Map<String, String> map) {
        return apiService.videoAudioIsEnough(map);
    }
    public Observable<BaseResponse<ChatVideoMatchEntity>> videoMatch(Map<String, String> map) {
        return apiService.videoMatch(map);
    }
    public Observable<BaseResponse> callMatch(Map<String, String> map) {
        return apiService.callMatch(map);
    }
    public Observable<BaseListResponse<HomeRankEntity>> rankList(Map<String, String> map) {
        return apiService.rankList(map);
    }
    public Observable<BaseResponse> userEditAvatar(Map<String, String> map) {
        return apiService.userEditAvatar(map);
    }
    public Observable<BaseResponse> userEditNick(Map<String, String> map) {
        return apiService.userEditNick(map);
    }
    public Observable<BaseResponse> userEditSign(Map<String, String> map) {
        return apiService.userEditSign(map);
    }
    public Observable<BaseResponse> userEditBirthday(Map<String, String> map) {
        return apiService.userEditBirthday(map);
    }
    public Observable<BaseResponse> userEditHeight(Map<String, String> map) {
        return apiService.userEditHeight(map);
    }
    public Observable<BaseResponse> userEditWeight(Map<String, String> map) {
        return apiService.userEditWeight(map);
    }
    public Observable<BaseResponse> userEditIncome(Map<String, String> map) {
        return apiService.userEditIncome(map);
    }
    public Observable<BaseResponse> userEditEducation(Map<String, String> map) {
        return apiService.userEditEducation(map);
    }
    public Observable<BaseResponse> userEditWork(Map<String, String> map) {
        return apiService.userEditWork(map);
    }
    public Observable<BaseResponse> userEditAddress(Map<String, String> map) {
        return apiService.userEditAddress(map);
    }
    public Observable<BaseResponse> userEditLabel(Map<String, String> map) {
        return apiService.userEditLabel(map);
    }
    public Observable<BaseListResponse<UserHeightEntity>> userEditHeightList(Map<String, String> map) {
        return apiService.userEditHeightList(map);
    }
    public Observable<BaseListResponse<UserHeightEntity>> userEditWeightList(Map<String, String> map) {
        return apiService.userEditWeightList(map);
    }
    public Observable<BaseListResponse<UserHeightEntity>> userEditIncomeList(Map<String, String> map) {
        return apiService.userEditIncomeList(map);
    }
    public Observable<BaseListResponse<UserHeightEntity>> userEditEducationList(Map<String, String> map) {
        return apiService.userEditEducationList(map);
    }
    public Observable<BaseListResponse<UserWorkEntity>> userEditWorkList(Map<String, String> map) {
        return apiService.userEditWorkList(map);
    }
    public Observable<BaseResponse<UserAddressResult>> userEditAddressList(Map<String, String> map) {
        return apiService.userEditAddressList(map);
    }
    public Observable<BaseResponse<UserLabelResult>> userEditLabelList(Map<String, String> map) {
        return apiService.userEditLabelList(map);
    }
    public Observable<BaseResponse<VoiceRandomSignEntity>> voiceRandomSign(Map<String, String> map) {
        return apiService.voiceRandomSign(map);
    }
    public Observable<BaseListResponse<UserVoiceResult>> uploadFile(File file) {
        RequestBody body = RequestBody.create(MediaType.parse("multipart/form-data"), file);
        MultipartBody.Part imagePart = MultipartBody.Part.createFormData("files", file.getName(), body);
        return apiService.uploadFile(imagePart);
    }

    public Observable<BaseResponse> userEditXingxiang(File file) {
        RequestBody body = RequestBody.create(MediaType.parse("multipart/form-data"), file);
        MultipartBody.Part imagePart = MultipartBody.Part.createFormData("image", file.getName(), body);
        return apiService.userEditXingxiang(imagePart);
    }
    public Observable<BaseResponse> userEditXingxiangDelete(Map<String, String> map) {
        return apiService.userEditXingxiangDelete(map);
    }

    public Observable<BaseResponse> voiceSignature(Map<String, String> map) {
        return apiService.voiceSignature(map);
    }

    public Observable<BaseListResponse<FollowEntity>> followList(Map<String, String> map) {
        return apiService.followList(map);
    }

    public Observable<BaseListResponse<IntimacyEntity>> intimacyList(Map<String, String> map) {
        return apiService.intimacyList(map);
    }

    public Observable<BaseListResponse<FollowEntity>> fansList(Map<String, String> map) {
        return apiService.fansList(map);
    }

    public Observable<BaseResponse<SignResult>> signList(Map<String, String> map) {
        return apiService.signList(map);
    }

    public Observable<BaseResponse<SignAddResult>> signAdd(Map<String, String> map) {
        return apiService.signAdd(map);
    }

    public Observable<BaseResponse> signTip(Map<String, String> map) {
        return apiService.signTip(map);
    }

    public Observable<BaseListResponse<TaskEntity>> taskList(Map<String, String> map) {
        return apiService.taskList(map);
    }
    public Observable<BaseResponse> realSave(Map<String, String> map) {
        return apiService.realSave(map);
    }
    public Observable<BaseResponse> realSaveIos(Map<String, String> map) {
        return apiService.realSaveIos(map);
    }
    public Observable<BaseResponse<String>> realToken(Map<String, String> map) {
        return apiService.realToken(map);
    }

    public Observable<BaseResponse<InviteEntity>> inviteInfo(Map<String, String> map) {
        return apiService.inviteInfo(map);
    }
    public Observable<BaseListResponse<InviteIncomeEntity>> invite1(Map<String, String> map) {
        return apiService.invite1(map);
    }
    public Observable<BaseListResponse<InviteIncomeEntity>> invite2(Map<String, String> map) {
        return apiService.invite2(map);
    }
    public Observable<BaseListResponse<InviteRankEntity>> invite3(Map<String, String> map) {
        return apiService.invite3(map);
    }
    public Observable<BaseResponse<UserConfigEntity>> setup(Map<String, String> map) {
        return apiService.setup(map);
    }
    public Observable<BaseResponse> writeOff(Map<String, String> map) {
        return apiService.writeOff(map);
    }
    public Observable<BaseResponse<VersionEntity>> versionInfo(Map<String, String> map) {
        return apiService.versionInfo(map);
    }
    public Observable<BaseResponse<MineLookResult>> lookList(Map<String, String> map) {
        return apiService.lookList(map);
    }
    public Observable<BaseListResponse<ShopEntity>> shopList(Map<String, String> map) {
        return apiService.shopList(map);
    }
    public Observable<BaseListResponse<ShopEntity>> shopMountsList(Map<String, String> map) {
        return apiService.shopMountsList(map);
    }
    public Observable<BaseResponse<ShopMyResult>> shopMyList(Map<String, String> map) {
        return apiService.shopMyList(map);
    }
    public Observable<BaseResponse> shopBuy(Map<String, String> map) {
        return apiService.shopBuy(map);
    }
    public Observable<BaseResponse> shopDefault(Map<String, String> map) {
        return apiService.shopDefault(map);
    }
    public Observable<BaseResponse> shopDefaultCancel(Map<String, String> map) {
        return apiService.shopDefaultCancel(map);
    }
    public Observable<BaseResponse<PriceResult>> priceInfo(Map<String, String> map) {
        return apiService.priceInfo(map);
    }
    public Observable<BaseResponse> priceSave(Map<String, String> map) {
        return apiService.priceSave(map);
    }
    public Observable<BaseResponse> priceState(Map<String, String> map) {
        return apiService.priceState(map);
    }
    public Observable<BaseListResponse<NoticeEntity>> messageSystem(Map<String, String> map) {
        return apiService.messageSystem(map);
    }
    public Observable<BaseListResponse<NoticeEntity>> messagePlatform(Map<String, String> map) {
        return apiService.messagePlatform(map);
    }
    public Observable<BaseResponse<NoticeLastResult>> messageLast(Map<String, String> map) {
        return apiService.messageLast(map);
    }
    public Observable<BaseListResponse<CharmEntity>> charmList(Map<String, String> map) {
        return apiService.charmList(map);
    }
    public Observable<BaseListResponse<CharmEntity>> diamondList(Map<String, String> map) {
        return apiService.diamondList(map);
    }
    public Observable<BaseListResponse<UserResult>> homeRandomUserList(Map<String, String> map) {
        return apiService.homeRandomUserList(map);
    }
    public Observable<BaseResponse> homeSelectAccost(Map<String, String> map) {
        return apiService.homeSelectAccost(map);
    }
    public Observable<BaseResponse> actionLog(Map<String, String> map) {
        return apiService.actionLog(map);
    }
    public Observable<BaseResponse<TicketEntity>> tickUserInfo(Map<String, String> map) {
        return apiService.tickUserInfo(map);
    }
    public Observable<BaseResponse<TicketPriceEntity>> tickPrice(Map<String, String> map) {
        return apiService.tickPrice(map);
    }
    public Observable<BaseListResponse<GuardEntity>> guardList(Map<String, String> map) {
        return apiService.guardList(map);
    }
    public Observable<BaseResponse<GuardResult>> guardSave(Map<String, String> map) {
        return apiService.guardSave(map);
    }
    public Observable<BaseListResponse<HomeResult>> mapList(Map<String, String> map) {
        return apiService.mapList(map);
    }
    public Observable<BaseResponse> teaSave(Map<String, String> map) {
        return apiService.teaSave(map);
    }
    public Observable<BaseListResponse<TeaEntity>> teaList(Map<String, String> map) {
        return apiService.teaList(map);
    }
    public Observable<BaseResponse> buy(Map<String, String> map) {
        return apiService.buy(map);
    }
    public Observable<BaseResponse<Boolean>> isBuy(Map<String, String> map) {
        return apiService.isBuy(map);
    }
    public Observable<BaseResponse> userDelete(Map<String, String> map) {
        return apiService.userDelete(map);
    }
    public Observable<BaseListResponse<TripEntity>> tripList(Map<String, String> map) {
        return apiService.tripList(map);
    }
    public Observable<BaseResponse> tripSave(Map<String, String> map) {
        return apiService.tripSave(map);
    }
    public Observable<BaseListResponse<GameEntity>> gameList(Map<String, String> map) {
        return apiService.gameList(map);
    }
    public Observable<BaseListResponse<GameCommentEntity>> gameCommentList(Map<String, String> map) {
        return apiService.gameCommentList(map);
    }
    public Observable<BaseListResponse<HomeSearchEntity>> homeSearchList(Map<String, String> map) {
        return apiService.homeSearchList(map);
    }
    public Observable<BaseResponse<ExchangeResult>> exchangeList(Map<String, String> map) {
        return apiService.exchangeList(map);
    }
    public Observable<BaseResponse> exchange(Map<String, String> map) {
        return apiService.exchange(map);
    }
    public Observable<BaseListResponse<ExchangeEntity>> exchangeRecordList(Map<String, String> map) {
        return apiService.exchangeRecordList(map);
    }
    public Observable<BaseListResponse<ExpressionEntity>> expressionList(Map<String, String> map) {
        return apiService.expressionList(map);
    }
    public Observable<BaseResponse> expressionAdd(Map<String, String> map) {
        return apiService.expressionAdd(map);
    }
    public Observable<BaseResponse> expressionDelete(Map<String, String> map) {
        return apiService.expressionDelete(map);
    }
    public Observable<BaseResponse> reportSave(Map<String, String> map) {
        return apiService.reportSave(map);
    }
    public Observable<BaseResponse<Boolean>> isWhiteIp(Map<String, String> map) {
        return apiService.isWhiteIp(map);
    }


}
